﻿using System;
using DefaultNamespace;
using DSFramework;
using UnityEngine;

public class SoldierBuilder : ICharacterBuilder
{
    public SoldierBuilder(ICharacter character, Type type, WeaponType weaponType, Vector3 spawnPos, int lv) : base(
        character, type, weaponType, spawnPos, lv)
    {
    }

    public override void AddCharacterAttr()
    {
        CharacterBaseAttr baseAttr = FactoryManager.AttrFactory.GetCharacterBaseAttr(mType);
        mPrefabName = baseAttr.MPrefabName;
        ICharacterAttr attr = new SoldierAttr(new SoldierAttrStrategy(), mLv, baseAttr);
        mCharacter.Attr = attr;
    }

    public override void AddGameObject()
    {
        //创建角色游戏物体
        //1,加载  2,实例化 TODO 
        GameObject characterGo = FactoryManager.AssetFactory.LoadSoldier(mPrefabName);
        characterGo.Pos(mSpawnPos);
        mCharacter.GameObject = characterGo;
    }

    public override void AddWeapon()
    {
        //添加武器
        //TODO
        IWeapon weapon = FactoryManager.WeaponFactory.CreateWeapon(mWeaponType);
        mCharacter.Weapon = weapon;
    }

    public override ICharacter GetResult()
    {
        return mCharacter;
    }
}